
#region Using Statements
using System;
using System.Collections.Generic;//using System.Xml.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion



namespace Pauliver
{

    [Serializable]
    class Settled_Ground : Component
    {
        Vector2 _previousposition;
        bool _settled;

        public Settled_Ground()
        {
            base._Type = ComponentType.Settled_Ground;
            _settled = false;
        }

        public bool Settled
        {
            get { return _settled; }
            set { _settled = value; }
        }


        public override void Update(GameTime p_time)
        {
            if (!_settled)
            {
                _previousposition = (base.Parent[ComponentType.Game_Position] as Game_Position).Position;
            }
            if (_settled)
            {
                if (base.Parent[ComponentType.Collidable] != null)
                {
                    (base.Parent[ComponentType.Collidable] as Collidable).Moving = false;
                }
                (base.Parent[ComponentType.Game_Position] as Game_Position).Position = _previousposition;
            }
        }

        public override void Init()
        {
            _previousposition = (base.Parent[ComponentType.Game_Position] as Game_Position).Position;
        }
    }
}
